
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	template="/tutor/template/main.xhtml">

	<ui:define name="body">
		<h:form prependId="false">

			<p:fieldset legend="#{messages['acompanhamento.label']}"
				toggleable="true" toggleSpeed="500">
				<h:panelGrid id="fields" columns="3">

					<h:outputLabel value="#{messages['acompanhamento.label.id']}: "
						for="id" styleClass="text-input" />
					<h:outputText id="id" value="#{acompanhamentoEditMB.bean.id}" />
					<p:message for="id" />

					<h:outputLabel value="#{messages['acompanhamento.label.turma']}: "
						for="turma" styleClass="text-input" />
					<h:selectOneMenu id="turma" style="width:300px;" required="true"
						value="#{acompanhamentoEditMB.turma}" converter="turmaConverter">
						<f:selectItem itemLabel="Selecione turma" itemValue="-1" />
						<f:selectItems value="#{acompanhamentoEditMB.turmas}" var="turma"
							itemLabel="#{turma.codigo}" itemValue="#{turma}" />

						<f:ajax event="change" execute="@this" render="aluno"
							listener="#{acompanhamentoEditMB.changeTurma()}"/>

					</h:selectOneMenu>
					<p:message for="turma" />

					<h:outputLabel value="#{messages['acompanhamento.label.aluno']}: "
						for="aluno" styleClass="text-input" />
					<h:selectOneMenu id="aluno" style="width:300px;" required="true"
						value="#{acompanhamentoEditMB.idAluno}">
						<f:selectItem itemLabel="Selecione aluno" itemValue="" />
						<f:selectItems value="#{acompanhamentoEditMB.alunos}" var="aluno"
							itemLabel="#{aluno.usuario.nome}" itemValue="#{aluno.id}" />
					</h:selectOneMenu>
					<p:message for="aluno" />

					<h:outputLabel value="#{messages['acompanhamento.label.situacao']}"
						for="situacao" styleClass="text-input" />
					<h:selectOneMenu id="situacao"
						value="#{acompanhamentoEditMB.bean.situacao}" required="true">
						<f:selectItem itemLabel="Selecione situação" itemValue="" />
						<f:selectItems value="#{acompanhamentoEditMB.situacoes}"
							var="situacao" itemLabel="#{situacao.label}"
							itemValue="#{situacao.value}" />
					</h:selectOneMenu>
					<p:message for="situacao" />

					<h:outputLabel
						value="#{messages['acompanhamento.label.ocorrencia']}: "
						for="ocorrencia" styleClass="text-input" />
					<p:calendar id="ocorrencia"
						value="#{acompanhamentoEditMB.bean.ocorrencia}"
						style="width:100px;" pattern="#{messages['label.date.pattern']}"
						navigator="true" showButtonPanel="true" locale="pt_BR"
						title="#{messages['acompanhamento.alt.ocorrencia']}"
						required="true" />
					<p:message for="ocorrencia" />

					<h:outputLabel
						value="#{messages['acompanhamento.label.acompanhamento']}: "
						for="acompanhamento" styleClass="text-input" />
					<h:inputTextarea id="acompanhamento"
						value="#{acompanhamentoEditMB.bean.acompanhamento}" cols="60"
						rows="5" required="true" />
					<p:message for="acompanhamento" />

				</h:panelGrid>

			</p:fieldset>

			<br />

			<p:toolbar>
				<p:toolbarGroup align="left">
					<p:commandButton value="#{messages['button.save']}"
						action="#{acompanhamentoEditMB.insert}"
						rendered="#{!acompanhamentoEditMB.updateMode}" ajax="false" />
					<p:commandButton value="#{messages['button.save']}"
						action="#{acompanhamentoEditMB.update}"
						rendered="#{acompanhamentoEditMB.updateMode}" ajax="false" />
					<p:commandButton value="#{messages['button.delete']}"
						onclick="confirmation.show()"
						rendered="#{acompanhamentoEditMB.updateMode}" type="button"
						immediate="true" ajax="false" />

					<p:button value="#{messages['button.back']}"
						outcome="acompanhamento_list" />

					<p:confirmDialog message="#{messages['label.confirm.delete']}"
						showEffect="bounce" hideEffect="explode"
						header="#{messages['label.dialog.delete']}" severity="alert"
						widgetVar="confirmation">
						<h:commandButton value="#{messages['button.dialog.yes']}"
							action="#{acompanhamentoEditMB.delete}" immediate="true"
							ajax="false" />
						<h:commandButton value="#{messages['button.dialog.no']}"
							onclick="confirmation.hide()" type="button" />
					</p:confirmDialog>
				</p:toolbarGroup>
			</p:toolbar>

		</h:form>		

	</ui:define>
</ui:composition>